<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$meta_title|default='首页'} | 后台管理系统</title>
    <link href="__STATIC__/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="__STATIC__/admin/css/bootstrap-treeview.min.css" rel="stylesheet">
    <link href="__STATIC__/admin/font-awesome/css/font-awesome.css" rel="stylesheet">
    <!-- Toastr style -->
    <link href="__STATIC__/admin/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <!-- Gritter -->
    <link href="__STATIC__/admin/js/plugins/gritter/jquery.gritter.css" rel="stylesheet">
    <!-- FooTable -->
    <link href="__STATIC__/admin/css/plugins/footable/footable.core.css" rel="stylesheet">
    <link href="__STATIC__/admin/css/plugins/ladda/ladda-themeless.min.css" rel="stylesheet">
    <link href="__STATIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/admin/css/style.css?v=0.1" rel="stylesheet">
    <link href="__STATIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__STATIC__/admin/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
</head>

<body class="fixed-sidebar pace-done">
<div id="wrapper">
    {include file="public/left"}

    <div id="page-wrapper" class="gray-bg">
        <div class="border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li>
                        <a href="/admin/logout">
                            <i class="fa fa-sign-out"></i> 退出
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="wrapper border-bottom white-bg page-heading clearfix">
            <div class="col-lg-10">
                <ol class="breadcrumb">
                    {$breadcrumb|raw}
                </ol>
            </div>
        </div>
        {block name="content"} {/block}

        <div class="footer">
            <div>
                <strong>Copyright</strong> HPP Company &copy; 2018-至今
            </div>
        </div>
    </div>
</div>

<!-- Mainly scripts -->
<script src="__STATIC__/admin/js/jquery-2.1.1.js"></script>
<script src="__STATIC__/admin/js/bootstrap.min.js"></script>
<script src="__STATIC__/admin/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="__STATIC__/admin/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>

<!-- Flot -->
<script src="__STATIC__/admin/js/plugins/flot/jquery.flot.js"></script>
<script src="__STATIC__/admin/js/plugins/flot/jquery.flot.tooltip.min.js"></script>
<script src="__STATIC__/admin/js/plugins/flot/jquery.flot.spline.js"></script>
<script src="__STATIC__/admin/js/plugins/flot/jquery.flot.resize.js"></script>
<script src="__STATIC__/admin/js/plugins/flot/jquery.flot.pie.js"></script>

<!-- Peity -->
<script src="__STATIC__/admin/js/plugins/peity/jquery.peity.min.js"></script>
<script src="__STATIC__/admin/js/demo/peity-demo.js"></script>

<!-- Custom and plugin javascript -->
<script src="__STATIC__/admin/js/inspinia.js"></script>
<script src="__STATIC__/admin/js/plugins/pace/pace.min.js"></script>

<!-- jQuery UI -->
<script src="__STATIC__/admin/js/plugins/jquery-ui/jquery-ui.min.js"></script>

<!-- GITTER -->
<script src="__STATIC__/admin/js/plugins/gritter/jquery.gritter.min.js"></script>

<!-- Sparkline -->
<script src="__STATIC__/admin/js/plugins/sparkline/jquery.sparkline.min.js"></script>

<!-- Sparkline demo data  -->
<script src="__STATIC__/admin/js/demo/sparkline-demo.js"></script>

<!-- ChartJS-->
<script src="__STATIC__/admin/js/plugins/chartJs/Chart.min.js"></script>

<!-- Toastr -->
<script src="__STATIC__/admin/js/plugins/toastr/toastr.min.js"></script>

<!-- FooTable -->
<script src="__STATIC__/admin/js/plugins/footable/footable.all.min.js"></script>
<!-- Jquery Validate -->
<script src="__STATIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
<script src="__STATIC__/admin/layer/layer.js"></script>
<script src="__STATIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="__STATIC__/admin/js/common.js?v=1.0"></script>
<!--js treeview-->
<script src="__STATIC__/admin/js/bootstrap-treeview.min.js"></script>
<!-- Ladda -->
<script src="__STATIC__/admin/js/plugins/ladda/spin.min.js"></script>
<script src="__STATIC__/admin/js/plugins/ladda/ladda.min.js"></script>
<script src="__STATIC__/admin/js/plugins/ladda/ladda.jquery.min.js"></script>

<script>
    $('.i-checks').iCheck({
        checkboxClass: 'icheckbox_square-green'
    });
    <?php $arr = ['Admin','Role','Data','Permission'];if(in_array($controller,$arr)){ ?>
        // 显示添加弹窗
        $('.modal-create').click(function(){
            $('#modal-form').modal('show');
        });
        // 全选/反选
        $('.total-checkbox').on('ifChecked', function(e){
            $('.item-checkbox').iCheck('check');
        });
        $('.total-checkbox').on('ifUnchecked', function(e){
            $('.item-checkbox').iCheck('uncheck');
        });


    <?php } ?>
    function showModal(obj,data,title, btn = 'add-menu'){
        var modal = $('#'+obj);
        modal.find('.modal-title').text(title);
        modal.find('.'+btn).attr('data-id',data.id);
        for(item in data){
            var object = modal.find('[name="'+item+'"]');
            if (object.length > 0) {
                object.val(data[item]);
            }
        }
        modal.modal('show');
    }

    function hide_model(fieldArr = []){
        $('#modal-form').on('hide.bs.modal', function () {
            var params = $('.menu-common').length;
            for (var i = 0; i < params; i++) {
                $('.menu-common').eq(i).val('');
                $('.menu-common').eq(i).parent().parent().removeClass('has-error');
            }
            if(fieldArr.length != 0){
                for(var i=0; i<fieldArr.length; i++){
                    $('input[name="'+fieldArr[i]+'"]').val('');
                }
            }
            $('.error-info').addClass('hide')
        })
    }

    function delete_data(url){
        $('.deletes').click(function(){
            var ids = $('.item-checkbox').serialize();
            layer.confirm('确认删除吗',{
                btn:['确认','取消']
            },function(){
                $.get(url,ids,function(res){
                    if (res.code==1) {
                        alertMsg(res.msg,'success',false);
                        setTimeout( () => {
                            for(var i=0;i<res.data.length;i++){
                            $('#del-'+res.data[i]).remove();
                        }
                    },2000 );
                    }else{
                        alertMsg(res.msg,'error',false);
                    }
                },'json');

                layer.closeAll('dialog');
            });
        });
    }

    function delete_one(){
        $('.delete').click(function(){
            var url = $(this).attr('href');
            var id = $(this).attr('data-id');
            layer.confirm('确认删除吗',{
                btn:['确认','取消']
            },function(){
                $.ajax({
                    url: url,
                    type: 'DELETE',
                    success: function(res){
                        if (res.code==1) {
                            alertMsg(res.msg,'success',false);
                            setTimeout( () => {
                                $('#del-'+id).remove();
                        },2000 );
                        }else{
                            alertMsg(res.msg,'error',false);
                        }
                    },
                    dataType: 'json'
                });

                layer.closeAll('dialog');
            });
            return false;
        });
    }
</script>

{block name="js"}{/block}
</body>
</html>
